@model IEnumerable<Web.Models.Ticket>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            ReportedBy
        </th>
        <th>
            ResolvedBy
        </th>
        <th>
            Opened
        </th>
        <th>
            Closed
        </th>
        <th>
            Updated
        </th>
        <th>
            Status
        </th>
        <th>
            Detail
        </th>
        <th>
            History
        </th>
        <th>
            AssignedTo
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.TicketId }) |
            @Html.ActionLink("Details", "Details", new { id=item.TicketId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.TicketId })
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.ReportedBy).ToString()
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.ResolvedBy).ToString()
        </td>
        <td>
			@String.Format("{0:g}", item.Opened)
        </td>
        <td>
			@String.Format("{0:g}", item.Closed)
        </td>
        <td>
			@String.Format("{0:g}", item.Updated)
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Status).ToString()
        </td>
        <td>
			@item.Detail
        </td>
        <td>
			@(item.History == null ? "None" : item.History.Count.ToString())
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.AssignedTo).ToString()
        </td>
    </tr>
}

</table>


